sizerequest: Only check reported baselines if requested
authorTimm Bäder <mail@baedert.org>
Sun, 15 Jul 2018 15:56:11 +0000 (17:56 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 17 Jul 2018 15:33:47 +0000 (17:33 +0200)
If the passed-in store locations for the baselines are NULL anyway, we
don't need to check the reported baselines for correctness.

gtk/gtksizerequest.c

index f85f9893379c9c5ba27a9712480179bb759dc807..411cc103bcdb54f45f6f0f1f873ffcdd760fa83b 100644 (file)
@@ -129,6 +129,7 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
                                        gint             *minimum_baseline,
                                        gint             *natural_baseline)
 {
+  const gboolean baselines_requested = (minimum_baseline != NULL || natural_baseline != NULL);
   SizeRequestCache *cache;
   gint min_size = 0;
   gint nat_size = 0;
@@ -291,7 +292,7 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
           nat_size = adjusted_natural;
         }
 
-      if (min_baseline != -1 || nat_baseline != -1)
+      if (baselines_requested && (min_baseline != -1 || nat_baseline != -1))
        {
          if (orientation == GTK_ORIENTATION_HORIZONTAL)
            {